package de.fhffm.scs.simulator.data;

import java.util.ArrayList;

import org.csstudio.swt.xygraph.dataprovider.IDataProvider;
import org.csstudio.swt.xygraph.dataprovider.IDataProviderListener;
import org.csstudio.swt.xygraph.dataprovider.ISample;
import org.csstudio.swt.xygraph.linearscale.Range;

public class BloodSugarDB implements IDataProvider {

	ArrayList<BloodSugarLevel> data;

	public BloodSugarDB() {
		data = new ArrayList<BloodSugarLevel>();
	}

	public void addDataProviderListener(IDataProviderListener arg0) {
	}

	@Override
	public ISample getSample(int arg0) {
		return data.get(arg0);
	}

	@Override
	public int getSize() {
		return data.size();
	}

	public void addBloodSugarLevel(BloodSugarLevel newbsl) {
		data.add(newbsl);
	}

	public void removebloodsugarlevel(int position) {
		data.remove(position);
	}

	@Override
	public Range getXDataMinMax() {
		Range r = new Range(data.get(0).getTimestamp(), data.get(
				data.size() - 1).getTimestamp());
		return r;
	}

	@Override
	public Range getYDataMinMax() {
		Range xrange = new Range(0, 400);
		return xrange;
	}

	@Override
	public boolean isChronological() {
		return true;
	}

	@Override
	public boolean removeDataProviderListener(IDataProviderListener listener) {
		return false;
	}

}
